/*
 * @Author: wangtao
 * @Date: 2021-04-09 15:03:37
 * @LastEditors: 汪滔
 * @LastEditTime: 2021-04-15 10:15:16
 * @Description: file content
 */

import React, { Component } from 'react';
import { StyleSheet, Image, TouchableOpacity } from 'react-native';
import { px2dp } from '@/styles';

export default class Avatar extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  handleFunc = () => {
    this.props.onClick && this.props.onClick();
  }

  render() {
    const { avatar } = this.props;
    return (
      <TouchableOpacity activeOpacity={1} onPress={this.handleFunc}>
        <Image
          style={styles.avatarIcon}
          source={avatar ? { uri: avatar } : require('../../../../image/icons/defaultman.png')}
        />
      </TouchableOpacity>
    );
  }
}
const styles = StyleSheet.create({
  avatarIcon: {
    width: px2dp(76) * 2,
    height: px2dp(76) * 2,
    borderRadius: px2dp(40) * 2,
    borderColor: '#FDF4F0',
    borderWidth: px2dp(5) * 2
  },
});
